{% extends 'BudgetBudgetBundle::layout.html.twig' %}

{% block javascripts %}
    {% javascripts '@BudgetBudgetBundle/Resources/public/js/*' %}
        <script type="text/javascript" src="{{ asset_url }}"></script>
    {% endjavascripts %}
    
    <script type="text/javascript">
      $( document ).ready(function() {
         $('.showConfirmMsg').click(function(){
            return category.showConfirmMsg();
         });
      });
    </script>
{% endblock %}

{% block home_content %}   
    <div class="container">
        <table class="table">
            <thead>
                <tr>
                    <th>Category name:</th>
                    <th>Subcategory:</th>
                    <th>Action:</th>
                </tr>
            </thead>
            <tbody>
                {% for category in categories %}
                <tr>
                    <td>{{ category.name }}</td>
                    <td>{{ category.parent }}</td>
                    <td>
                        <form action="{{ path('BudgetBudgetBundle_categories_del') }}" method="post">
                            <input type="hidden" name="id" value="{{ category.id }}" >
                            <input type="submit" name="del" value="Del">
                        </form>
                        <a href="{{ path('BudgetBudgetBundle_categories_del', {id: category.id}) }}" title="Delete Category" class="showConfirmMsg"><span class="glyphicon glyphicon-remove-circle"></span></a>
                        <a href="{{ path('BudgetBudgetBundle_categories_edit', {id: category.id}) }}" title="Edit Category"><span class="glyphicon glyphicon-edit"></span></a>
                    </td>
                </tr>
                {% endfor %}
            </tbody>
        </table>
    </div>      
{% endblock %}
